<?php
$this->Html->addCrumb('Ads main', '/admin/ads/main');
$this->Html->addCrumb('Rotating Ads', '/admin/rotatingAds');
$this->Html->addCrumb('Add');
?>
<?php 
$this->Html->scriptStart(array('inline' => false));
echo '
      $(function(){
        $("#RotatingAdAdminAddForm").TWS_Form( {
          validate : {
          rules : {
            RotatingAdAdLocation : {required : true, help : "This is the location on the page where the ad will be displayed."},
            RotatingAdDescription: { required:true, help : "This is a description of the ad. It will help you as an administrator to identify the ad.<br/><br/>This text will not be displayed with the actual ad."},
            RotatingAdAdText: { help : "This is the actual text that will be displayed with the ad."},
            RotatingAdStartDate : {required: true, date : true, help : "This is the start date when the ad will begin"},
            RotatingAdEndDate : {required: true, date : true, help : "This is the end date when the ad will stop running"}
          }
          }});
        });
       ';
$this->Html->scriptEnd();
?>
<h1>Add Ad</h1>

<?php echo '<div id="actionLink">'.$this->Html->link('Back to list of Ads',array('action'=>'index','admin'=>true)).'</div>'; ?>

<?php echo $this->element('errors', array('errors' => isset($errors)? $errors : null)); ?>
<?php

echo $this->TWSForm->create('RotatingAd',  array(
    'inputDefaults' => array(
        'div' => array('class'=>'row')),
        'class'=>'inlineForm',
        'type'=>'file'));

echo $this->TWSForm->input('ad_location', array('name'=>'RotatingAdAdLocation','type'=>'select', 'label'=>'<span class="required">*</span>Ad location','options'=>$options));
echo $this->TWSForm->input('description', array('rows'=>'5','cols'=>'60','name'=>'RotatingAdDescription', 'label'=>'<span class="required">*</span>Description'));
echo $this->TWSForm->input('ad_text', array('rows'=>'5','cols'=>'60','name'=>'RotatingAdAdText', 'label'=>'Text for ad'));
echo $this->TWSForm->input('image_path', array('type'=>'file', 'label'=>'Upload photo', 'name'=>'RotatingAdImagePath'));
echo $this->TWSForm->input('start_date', array('type'=>'text', 'rel'=>'date','name'=>'RotatingAdStartDate', 'label'=>'<span class="required">*</span>Start Date'));
echo $this->TWSForm->input('end_date', array('type'=>'text', 'rel'=>'date','name'=>'RotatingAdEndDate', 'label'=>'<span class="required">*</span>End Date'));
echo $this->TWSForm->end( array("label"=>"Add", "class"=>"button"));


?>